package com.sxt.sys.controller;

import com.sxt.springcloud.sys.CacheClientService;
import com.sxt.sys.common.DataGridView;
import com.sxt.sys.common.ResultObj;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
@RequestMapping("cache")
public class CacheController {

    @Autowired
    private CacheClientService cacheClientService;

    /**
     * 查询所有缓存
     */

    @RequestMapping("loadAllCache")
    public DataGridView loadAllCache() {
        return this.cacheClientService.loadAllCache();
    }

    /**
     * 删除缓存
     */
    @RequestMapping("deleteCache")
    public ResultObj deleteCache(String key) {
        return this.cacheClientService.deleteCache(key);
    }

    /**
     * 清空缓存
     */
    @RequestMapping("removeAllCache")
    public ResultObj removeAllCache() {
        return this.cacheClientService.removeAllCache();
    }

    /**
     * 同步缓存
     */
    @RequestMapping("syncCache")
    public ResultObj syncCache() {
        return this.cacheClientService.syncCache();
    }
}


